<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserAssetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_assets', function (Blueprint $table) {
            $table->unsignedBigInteger('user_id')->primary()->comment('用户id');
            $table->unsignedTinyInteger('mt')->default(0)->comment('积分');
            $table->decimal('at',8,2)->default(0)->comment('余额');
            $table->decimal('lock_at',8,2)->default(0)->comment('冻结余额');
            $table->unsignedInteger('lock_version')->default(1)->comment("乐观锁");
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_assets');
    }
}
